/**
 * Created by gantian on 2016/12/22.
 */
var express=require('express');
var router=express.Router();
var mongoose=require('../db/dbcon');
var Student=mongoose.model("Student");
router.get('/add',function(req,res,next){
  res.render('./index/interface-add');
});
router.post('/addint',function(req,res,next){
  console.log(req.body);

  var newStudent=new Student({
    name:req.body.name,
    age:req.body.age,
    score:req.body.score,
    sex:req.body.sex
  })
  newStudent.save(function(err,stu){
    if(err){
      console.log("出错啦:"+err)
    }
    console.log("新增成功:"+sut)
  })
  res.json({status:true,message:"新增成功"});
});
module.exports=router;
